home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Portable Patmos / src / portable kernel / mac / dup2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-04  |  207 b   |  15 lines  |  [TEXT/KAHL]

  1. #include "crtlocal.h"
  2.  
  3. int dup2(int fd1, int fd2)
  4.     {
  5.     mysleep(1);
  6.     if (crt_fd_tab[fd2].fd) close(fd2);
  7.     crt_fd_tab[fd2] = crt_fd_tab[fd1];
  8.     return fd2;
  9.     }
  10.  
  11. int dup(int fd)
  12.     {
  13.     return dup2(fd, next_fd());
  14.     }
  15.